// t3Pillar3.txt
// By Lazarus
// Summons a monster each turn.
// If machinery hasn't been destroyed yet, then will summon 2 golems.
// Otherwise summons one random monster from a group I've selected monster.
// Places monster in random location within four pillars.

begincreaturescript;
variables;
short monst,num,x,y;
body;

beginstate init_state;
	set_mobility(ME,0);
	if(get_flag(250,7) > 0)
		erase_char(ME);
break;

beginstate dead_state;
run_town_script(15);
break;

beginstate start_state;
if(get_flag(3,15) == 1)
	set_state_continue(3);
break;

beginstate 3;
if(char_ok(6) == 1)
if(get_health(6) <= 1500)
{	heal_char(6,(get_health(ME) + 500));
		put_jagged_zap(my_loc_x(),my_loc_y(),char_loc_x(6),char_loc_y(6),4);
		put_effect_on_char(6,10,10,0);
		run_animation_sound(60);
		kill_char(ME,2,0);
		message_dialog("Janok makes a gesture with his hand and an arc of energy from one of the nearby pillars strikes him. His wounds close up, but the pillar is ruined.","");  }

if(get_flag(10,9) > 0)
{	x = get_ran(1,21,27);
	y = get_ran(1,24,30);
	num = 1;
	monst = get_ran(1,1,10);
	if(monst == 1)
		monst = 58;
	if(monst == 2)
		monst = 60;
	if(monst == 3)
		monst = 87;
	if(monst == 4)
		monst = 64;
	if(monst == 5)
		monst = 100;
	if(monst == 6)
		monst = 131;
	if(monst == 7)
		monst = 132;
	if(monst == 8)
		monst = 165;
	if(monst == 9)
		monst = 163;
	if(monst == 10)
		monst = 182;
	place_monster(x,y,monst,2);
	put_boom_on_space(x,y,2,0);
	print_str("Pillar summons monster.");	
}

if(get_flag(10,9) == 0)
{	num = 0;
	while (num <= 1)
	{	x = get_ran(1,21,27);
		y = get_ran(1,24,30);
		monst = get_ran(1,1,5);
		if(monst == 1)
			monst = 241;
		if(monst == 2)
			monst = 245;
		if(monst == 3)
			monst = 246;
		if(monst == 4)
			monst = 250;
		if(monst == 5)
			monst = 253;
		place_monster(x,y,monst,2);
		put_boom_on_space(x,y,2,0);
		print_str("Pillar summons a monster.");
		num = num + 1; }
}
	run_animation_sound(10);
	end_combat_turn();
break;